package com.github.prontera.domain.enums;

import com.github.prontera.common.mybatis.handler.CodeEnum;

/**
 * 通用枚举类型
 */
public enum ClientTypeEnum implements CodeEnum<ClientTypeEnum> {

	SELF(0, "自建"), PULL(1, "拉取");

	private int code;
	private String desc;

	private ClientTypeEnum(int code, String desc) {
		this.code = code;
	}

	/**
	 * 通过枚举<code>name</code>获取枚举
	 */
	public static ClientTypeEnum getEnumByCode(Integer code) {
		if (code == null) {
			return null;
		}
		for (ClientTypeEnum enumm : ClientTypeEnum.values()) {
			if (enumm.getCode() == code.intValue()) {
				return enumm;
			}
		}
		return null;
	}

	@Override
	public int getCode() {
		return code;
	}

	public String getDesc() {
		return desc;
	}

}
